package hu.mapro.flang.gwt.client.ui.custom;

import com.google.inject.Inject;

import hu.mapro.flang.gwt.client.ui.UserPrivilegesEditor;
import hu.mapro.flang.gwt.domain.client.AutoBeans.CreateFieldVisitor;
import hu.mapro.flang.gwt.domain.client.AutoBeans.UserCreateFieldVisitor;
import hu.mapro.flang.gwt.domain.client.AutoBeans.UserPrivilege;
import hu.mapro.flang.gwt.domain.client.AutoBeans.UserPrivilegeFields;
import hu.mapro.flang.gwt.domain.client.AutoBeans.UserRequestContextHolder;
import hu.mapro.gwt.data.client.MoreSuppliers;
import hu.mapro.gwtui.gxt.client.fieldseditor.field.EditorFieldInterface;

public class CustomUserCreateFieldVisitor extends UserCreateFieldVisitor  {

	UserRequestContextHolder userRequestContextHolder;
	
	@Inject
	public CustomUserCreateFieldVisitor(CreateFieldVisitor createFieldVisitor,
			UserRequestContextHolder userRequestContextHolder) {
		super(createFieldVisitor);
		this.userRequestContextHolder = userRequestContextHolder;
	}



	@Override
	public EditorFieldInterface<?> privileges() {
		return new UserPrivilegesEditor(MoreSuppliers.from(userRequestContextHolder, UserPrivilege.class), UserPrivilegeFields.user);
	}

}
